{extend name="base"/}
 {block name="content"}
 <div id="header-frame">
 {include file="public:top" /}
 </div>
 <div id="frame-body">
 <div id="menu-frame" style="width: 40px;float: left;">
 {include file="public:menu" /}

 </div>
 <div id="main-frame" style="float: left;">
 <div id="dcMain">
   <!-- 当前位置 -->
<div id="urHere">管理中心<b>></b><strong>添加Banner分类</strong> </div>   <div class="mainBox" style="height:auto!important;height:550px;min-height:550px;">
            <h3>添加分类</h3>
    <form action="" id="data_type" method="post">
    	<style>
            	.tableBasic tr th,td{
            		height: 40px;
            	}
            	.btn{
            		width:100px;
            		height: 40px;
            		text-align: center;
            		line-height: 40px;
            		font-size: 18px;
            		margin:10px 50px;
            		padding: 0;
            		font-weight: 100;
            	}
            </style>
     <table width="100%" border="0" cellpadding="8" cellspacing="0" class="tableBasic">
      <tr>
       <td width="200" align="right">Banner分类名称</td>
       <td>
        <input type="text" id="banner_name" name="banner_name" value="{$banner['banner_name']}" size="40" class="inpMain" />
		<font style="display:none" class="adbanner_name" color='red'>名称不能为空！</font>
       </td>
      </tr>
      <tr>
       <td align="right">简单描述</td>
       <td>
        <textarea name="banner_description"  id="banner_describe" cols="60" rows="4" class="textArea">{$banner['banner_description']}</textarea>
       </td>
      </tr>
      <tr>
       <td align="right">排序</td>
       <td>
        <input type="text" id="banner_sort" name="banner_sort" value="{$banner['banner_sort']}" size="5" class="inpMain" />
		<font style="display:none" class="adbanner_sort" color='red'>排序不能为空！</font>
       </td>
      </tr>
      <tr>
       <td></td>
       <td>
        <input type="hidden" name="banner_id" value="{$banner['banner_id']}" />
        <input  class="btn" type="button" onclick='banner_add()' value="提交" />
       </td>
      </tr>
     </table>
    </form>
       </div>
 </div>
 <div class="clear"></div>
 <script type="text/javascript">
 $(function(){
$("#banner_name").blur(function(){
$(".adbanner_name").hide();
})
$("#banner_describe").blur(function(){
$(".adbanner_describe").hide();
})
$("#banner_sort").blur(function(){
$(".adbanner_sort").hide();
})
})
function banner_add(){
var success_url="{:url('admin/banner/index')}";
var url="{:url('admin/banner/add_bannertype')}";
var admins=$("#data_type").serialize();
//alert(admins);
var banner_name=$("#banner_name").val();
var banner_describe=$("#banner_describe").val();
var banner_sort=$("#banner_sort").val();


if((banner_name.length<1) || (banner_name.length>20)){
$(".adbanner_name").show();
}else if(banner_sort.length<1){
$(".adbanner_sort").show();
}else{
$.post(url,admins,function(result){
 
if(result.status=='4')
{
dialog.success(result.message,success_url);
}else
{
	dialog.error(result.message);
} 
})
}

}

 </script>
 
 </div>
  </div>
 {/block}